/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.gui;

import com.camachosanchez.bean.*;
import com.camachosanchez.controler.jpa.AlmacenesJpaController;
import com.camachosanchez.controler.jpa.DistribuidoresNeumaticosJpaController;
import com.camachosanchez.controler.jpa.EstadosMedicionJpaController;
import com.camachosanchez.controler.jpa.EstadosNeumaticosJpaController;
import com.camachosanchez.controler.jpa.FormasPagoJpaController;
import com.camachosanchez.controler.jpa.MarcasNeumaticoJpaController;
import com.camachosanchez.controler.jpa.ModelosBandaNeumaticoJpaController;
import com.camachosanchez.controler.jpa.TipoPisoJpaController;
import com.camachosanchez.gui.textfield.MaxLengthTextDocument;
import com.camachosanchez.process.HiloGuardarNeumaticos;
import com.camachosanchez.util.Constantes;
import com.camachosanchez.util.GUIUtil;
import java.awt.CardLayout;
import java.awt.event.KeyEvent;
import java.util.Date;
import java.util.List;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author Rolando
 */
public class RegistroMasivoNeumaticos extends javax.swing.JDialog {

    private CardLayout card;
    private int cantidad_neumáticos;
    private String prefijo;
    private String sufijo;
    private int indice_inicio;
    private int justificacion;
    private String[] codigos;

    /**
     * Creates new form RegistroMasivoNeumaticos
     */
    public RegistroMasivoNeumaticos(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        GUIUtil.addEscapeKey(this);
        setLocationRelativeTo(null);
        setModal(modal);
//        setAlwaysOnTop(true);
        card = (CardLayout) pnlCentral.getLayout();
        llenarListasDesplegables();
        dateFechaRegistro.setDate(new Date());
        dateFechaCompra.setDate(new Date());
        cantidad_neumáticos = 0;
        prefijo = "";
        sufijo = "";
        indice_inicio = 0;
        justificacion = 0;
        ChangeListener listener = new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                generacionCodigos();
            }
        };
        SpinnerModel sm1 = new SpinnerNumberModel(1, 1, 10000, 1);
        SpinnerModel sm2 = new SpinnerNumberModel(0, 0, 10000, 1);
        SpinnerModel sm3 = new SpinnerNumberModel(1, 1, 10000, 1);
        SpinnerModel sm4 = new SpinnerNumberModel(0, 0, 10000, 1);
        spnCantidadNeumaticos.setModel(sm1);
        spnIndiceInicio.setModel(sm2);
        spnJustificacion.setModel(sm3);
        spnNumeroCapas.setModel(sm4);
        spnCantidadNeumaticos.addChangeListener(listener);
        spnIndiceInicio.addChangeListener(listener);
        spnJustificacion.addChangeListener(listener);
        MaxLengthTextDocument doc_prefijo = new MaxLengthTextDocument();
        MaxLengthTextDocument doc_sufijo = new MaxLengthTextDocument();
        MaxLengthTextDocument doc_numfactura = new MaxLengthTextDocument();
        MaxLengthTextDocument profundidad_minima = new MaxLengthTextDocument();
        MaxLengthTextDocument presion_minima = new MaxLengthTextDocument();
        MaxLengthTextDocument doc_garantia_dias = new MaxLengthTextDocument();
        MaxLengthTextDocument doc_garantia_km = new MaxLengthTextDocument();
        MaxLengthTextDocument precio = new MaxLengthTextDocument();
        doc_prefijo.setMaxChars(5, Constantes.CADENAS);
        doc_sufijo.setMaxChars(5, Constantes.CADENAS);
        doc_numfactura.setMaxChars(20, Constantes.ANY);
        profundidad_minima.setMaxChars(8, Constantes.DECIMALES);
        presion_minima.setMaxChars(8, Constantes.DECIMALES);
        precio.setMaxChars(8, Constantes.DECIMALES);
        doc_garantia_dias.setMaxChars(10, Constantes.ENTEROS);
        doc_garantia_km.setMaxChars(10, Constantes.ENTEROS);
        txtPrefijoCodigo.setDocument(doc_prefijo);
        txtSufijoCodigo.setDocument(doc_sufijo);
        txtNumeroFactura.setDocument(doc_numfactura);
        txtProfundidadMinima.setDocument(profundidad_minima);
        txtPresionMinima.setDocument(presion_minima);
        txtGarantiaDias.setDocument(doc_garantia_dias);
        txtGarantiaKM.setDocument(doc_garantia_km);
        txtPrecioUnitario.setDocument(precio);
        txtProfundidadMinima.setText("0.0");
        txtPresionMinima.setText("0.0");
        txtPrecioUnitario.setText("0.0");
        txtGarantiaDias.setText("0");
        txtGarantiaKM.setText("0");
        txtPrefijoCodigo.getDocument().addDocumentListener(
                new javax.swing.event.DocumentListener() {

                    @Override
                    public void insertUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }

                    @Override
                    public void removeUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }

                    @Override
                    public void changedUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }
                });
        txtSufijoCodigo.getDocument().addDocumentListener(
                new javax.swing.event.DocumentListener() {

                    @Override
                    public void insertUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }

                    @Override
                    public void removeUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }

                    @Override
                    public void changedUpdate(javax.swing.event.DocumentEvent evt) {
                        generacionCodigos();
                    }
                });
        dateFechaRegistro.setMaxSelectableDate(new Date());
    }

    public JProgressBar getBarraProgreso() {
        return barraProgreso;
    }

    private void llenarListasDesplegables() {
        MarcasNeumaticoJpaController dao_marcas = new MarcasNeumaticoJpaController(null);
        AlmacenesJpaController dao_almacenes = new AlmacenesJpaController(null);
        TipoPisoJpaController dao_tipos_piso = new TipoPisoJpaController(null);
        ModelosBandaNeumaticoJpaController dao_bandas = new ModelosBandaNeumaticoJpaController(null);
        DistribuidoresNeumaticosJpaController dao_distribuidores = new DistribuidoresNeumaticosJpaController(null);
        FormasPagoJpaController dao_pagos = new FormasPagoJpaController(null);
        EstadosNeumaticosJpaController dao_estados = new EstadosNeumaticosJpaController(null);
        EstadosMedicionJpaController dao_estadosMedicion = new EstadosMedicionJpaController(null);
        List<MarcasNeumatico> marcas = dao_marcas.findMarcasNeumaticoEntities();
        List<Almacenes> almacenes = dao_almacenes.findAlmacenesEntities();
        List<TipoPiso> tipos_piso = dao_tipos_piso.findTipoPisoEntities();
        List<ModelosBandaNeumatico> bandas = dao_bandas.findModelosBandaNeumaticoEntities();
        List<DistribuidoresNeumaticos> distribuidores = dao_distribuidores.findDistribuidoresNeumaticosEntities();
        List<FormasPago> pagos = dao_pagos.findFormasPagoEntities();
        List<EstadosNeumaticos> estados = dao_estados.findEstadosNeumaticosEntities();
        List<EstadosMedicion> estadosMedicion = dao_estadosMedicion.findEstadosMedicionEntities();
        comboMarcas.setModel(new DefaultComboBoxModel(marcas.toArray()));
        comboAlmacenes.setModel(new DefaultComboBoxModel(almacenes.toArray()));
        comboTipoPiso.setModel(new DefaultComboBoxModel(tipos_piso.toArray()));
        comboBandas.setModel(new DefaultComboBoxModel(bandas.toArray()));
        comboDistribuidores.setModel(new DefaultComboBoxModel(distribuidores.toArray()));
        comboFormasPago.setModel(new DefaultComboBoxModel(pagos.toArray()));
        comboEstados.setModel(new DefaultComboBoxModel(estados.toArray()));
        cmbEstadoMedicion.setModel(new DefaultComboBoxModel(estadosMedicion.toArray()));
//        Almacenes a = (Almacenes) comboAlmacenes.getSelectedItem();
//        txtDireccionAlmacen.setInformacionUsuario(a.getDireccion());
//        txtTelefonoAlmacen.setInformacionUsuario(a.getTelefono());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlContenedor = new javax.swing.JPanel();
        pnlCentral = new javax.swing.JPanel();
        pnlPaso1 = new javax.swing.JPanel();
        pnlOpciones1 = new javax.swing.JPanel();
        btnCerrar1 = new javax.swing.JButton();
        btnAnterior1 = new javax.swing.JButton();
        btnSiguiente1 = new javax.swing.JButton();
        btnFinalizar1 = new javax.swing.JButton();
        pnlDatos1 = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        lblImagen1 = new javax.swing.JLabel();
        pnlDatosPaso1 = new javax.swing.JPanel();
        pnlContenedorUno = new javax.swing.JPanel();
        lblFechaRegistro = new javax.swing.JLabel();
        dateFechaRegistro = new com.toedter.calendar.JDateChooser();
        lblCantidadNeumaticos = new javax.swing.JLabel();
        spnCantidadNeumaticos = new javax.swing.JSpinner();
        lblPrefijoCodigo = new javax.swing.JLabel();
        txtPrefijoCodigo = new javax.swing.JTextField();
        lblSufijoCodigo = new javax.swing.JLabel();
        txtSufijoCodigo = new javax.swing.JTextField();
        lblIndiceInicio = new javax.swing.JLabel();
        spnIndiceInicio = new javax.swing.JSpinner();
        lblJustificacion = new javax.swing.JLabel();
        spnJustificacion = new javax.swing.JSpinner();
        lblVistaPrevia = new javax.swing.JLabel();
        txtVistaPrevia = new javax.swing.JTextField();
        jSeparator5 = new javax.swing.JSeparator();
        jPanel5 = new javax.swing.JPanel();
        pnlOpciones2 = new javax.swing.JPanel();
        btnCerrar2 = new javax.swing.JButton();
        btnAnterior2 = new javax.swing.JButton();
        btnSiguiente2 = new javax.swing.JButton();
        btnFinalizar2 = new javax.swing.JButton();
        pnlContenedor2 = new javax.swing.JPanel();
        jSeparator2 = new javax.swing.JSeparator();
        lblImagen2 = new javax.swing.JLabel();
        pnlDatos2 = new javax.swing.JPanel();
        pnlContenedorDatos2 = new javax.swing.JPanel();
        lblMarca = new javax.swing.JLabel();
        lblModelo = new javax.swing.JLabel();
        lblEstado = new javax.swing.JLabel();
        lblTipoPiso = new javax.swing.JLabel();
        comboMarcas = new javax.swing.JComboBox();
        comboBandas = new javax.swing.JComboBox();
        comboEstados = new javax.swing.JComboBox();
        comboTipoPiso = new javax.swing.JComboBox();
        lblAlmacen = new javax.swing.JLabel();
        comboAlmacenes = new javax.swing.JComboBox();
        jSeparator7 = new javax.swing.JSeparator();
        pnlPaso3 = new javax.swing.JPanel();
        pnlOpciones3 = new javax.swing.JPanel();
        btnCerrar3 = new javax.swing.JButton();
        btnAnterior3 = new javax.swing.JButton();
        btnSiguiente3 = new javax.swing.JButton();
        btnFinalizar3 = new javax.swing.JButton();
        pnlDatos3 = new javax.swing.JPanel();
        jSeparator3 = new javax.swing.JSeparator();
        lblImagen3 = new javax.swing.JLabel();
        pnlContenedorDatosPaso3 = new javax.swing.JPanel();
        pnlDatosPaso3 = new javax.swing.JPanel();
        lblNumeroCapas = new javax.swing.JLabel();
        spnNumeroCapas = new javax.swing.JSpinner();
        lblProfundidadMinima = new javax.swing.JLabel();
        txtProfundidadMinima = new javax.swing.JTextField();
        lblMM = new javax.swing.JLabel();
        lblPresionMinima = new javax.swing.JLabel();
        txtPresionMinima = new javax.swing.JTextField();
        lblLBS = new javax.swing.JLabel();
        lblEstadoMedicion = new javax.swing.JLabel();
        cmbEstadoMedicion = new javax.swing.JComboBox();
        pnlPaso4 = new javax.swing.JPanel();
        pnlOpciones4 = new javax.swing.JPanel();
        btnCerrar4 = new javax.swing.JButton();
        btnAnterior4 = new javax.swing.JButton();
        btnSiguiente4 = new javax.swing.JButton();
        btnFinalizar4 = new javax.swing.JButton();
        pnlContenedorPaso4 = new javax.swing.JPanel();
        jSeparator4 = new javax.swing.JSeparator();
        lblImagen4 = new javax.swing.JLabel();
        pnlContenedorDatosPaso4 = new javax.swing.JPanel();
        pnlDatos4 = new javax.swing.JPanel();
        lblNumeroFactura = new javax.swing.JLabel();
        txtNumeroFactura = new javax.swing.JTextField();
        lblFechaCompra = new javax.swing.JLabel();
        dateFechaCompra = new com.toedter.calendar.JDateChooser();
        lblDistribuidor = new javax.swing.JLabel();
        comboDistribuidores = new javax.swing.JComboBox();
        lblPrecioUnitario = new javax.swing.JLabel();
        txtPrecioUnitario = new javax.swing.JTextField();
        lblGarantiaDias = new javax.swing.JLabel();
        lblGarantiaKM = new javax.swing.JLabel();
        txtGarantiaDias = new javax.swing.JTextField();
        txtGarantiaKM = new javax.swing.JTextField();
        lblFormaPago = new javax.swing.JLabel();
        comboFormasPago = new javax.swing.JComboBox();
        pnlPasoFinal = new javax.swing.JPanel();
        pnlOpcionesFinales = new javax.swing.JPanel();
        pnlContenedorOpcionesFinales = new javax.swing.JPanel();
        btnCerrar5 = new javax.swing.JButton();
        btnAnterior5 = new javax.swing.JButton();
        btnSiguiente5 = new javax.swing.JButton();
        btnFinalizar5 = new javax.swing.JButton();
        jSeparator8 = new javax.swing.JSeparator();
        pnlContenedorFinal = new javax.swing.JPanel();
        lblImagenFinal = new javax.swing.JLabel();
        pnlDatosFinal = new javax.swing.JPanel();
        lblProgreso = new javax.swing.JLabel();
        barraProgreso = new javax.swing.JProgressBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle(".:: Asistente para el Registro Masivo de Neumáticos ::.");
        setResizable(false);

        pnlContenedor.setLayout(new java.awt.BorderLayout());

        pnlCentral.setBackground(new java.awt.Color(151, 184, 205));
        pnlCentral.setLayout(new java.awt.CardLayout());

        pnlPaso1.setLayout(new java.awt.BorderLayout());

        btnCerrar1.setText("Cerrar");
        btnCerrar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrar1ActionPerformed(evt);
            }
        });
        pnlOpciones1.add(btnCerrar1);

        btnAnterior1.setText("<< Anterior");
        btnAnterior1.setEnabled(false);
        pnlOpciones1.add(btnAnterior1);

        btnSiguiente1.setText("Siguiente >>");
        btnSiguiente1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguiente1ActionPerformed(evt);
            }
        });
        pnlOpciones1.add(btnSiguiente1);

        btnFinalizar1.setText("Finalizar");
        btnFinalizar1.setEnabled(false);
        pnlOpciones1.add(btnFinalizar1);

        pnlPaso1.add(pnlOpciones1, java.awt.BorderLayout.PAGE_END);

        pnlDatos1.setBackground(new java.awt.Color(151, 184, 205));
        pnlDatos1.setLayout(new java.awt.BorderLayout());
        pnlDatos1.add(jSeparator1, java.awt.BorderLayout.PAGE_END);

        lblImagen1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/banner_lateral.png"))); // NOI18N
        pnlDatos1.add(lblImagen1, java.awt.BorderLayout.LINE_START);

        pnlContenedorUno.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Información Principal", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
        pnlContenedorUno.setOpaque(false);

        lblFechaRegistro.setText("Fecha de registro:");

        dateFechaRegistro.setDateFormatString("dd/MM/yyyy");
        dateFechaRegistro.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                dateFechaRegistroKeyPressed(evt);
            }
        });

        lblCantidadNeumaticos.setText("Cantidad de neumáticos:");

        spnCantidadNeumaticos.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                spnCantidadNeumaticosKeyPressed(evt);
            }
        });

        lblPrefijoCodigo.setText("<html>Prefijo de código: <font color=\"green\">(*)</font> </html>");

        txtPrefijoCodigo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtPrefijoCodigoKeyPressed(evt);
            }
        });

        lblSufijoCodigo.setText("<html>Sufijo de código: <font color=\"green\">(*)</font> </html>");

        txtSufijoCodigo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtSufijoCodigoKeyPressed(evt);
            }
        });

        lblIndiceInicio.setText("Índice de Inicio:");

        spnIndiceInicio.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                spnIndiceInicioKeyPressed(evt);
            }
        });

        lblJustificacion.setText("Justificación:");

        spnJustificacion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                spnJustificacionKeyPressed(evt);
            }
        });

        lblVistaPrevia.setText("Vista previa:");

        txtVistaPrevia.setEditable(false);
        txtVistaPrevia.setFont(new java.awt.Font("Tahoma", 0, 14));

        javax.swing.GroupLayout pnlContenedorUnoLayout = new javax.swing.GroupLayout(pnlContenedorUno);
        pnlContenedorUno.setLayout(pnlContenedorUnoLayout);
        pnlContenedorUnoLayout.setHorizontalGroup(
            pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                        .addGap(56, 56, 56)
                        .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(lblCantidadNeumaticos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblFechaRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(dateFechaRegistro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(spnCantidadNeumaticos, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                    .addComponent(lblSufijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(txtSufijoCodigo))
                                .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                    .addComponent(lblIndiceInicio)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(spnIndiceInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                .addComponent(lblPrefijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtPrefijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                .addComponent(lblVistaPrevia)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtVistaPrevia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                                .addComponent(lblJustificacion)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(spnJustificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator5, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)))
                .addContainerGap())
        );

        pnlContenedorUnoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lblCantidadNeumaticos, lblFechaRegistro, lblIndiceInicio, lblJustificacion, lblPrefijoCodigo, lblSufijoCodigo, lblVistaPrevia});

        pnlContenedorUnoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {dateFechaRegistro, spnIndiceInicio, spnJustificacion, txtPrefijoCodigo, txtSufijoCodigo, txtVistaPrevia});

        pnlContenedorUnoLayout.setVerticalGroup(
            pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorUnoLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(dateFechaRegistro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblFechaRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCantidadNeumaticos)
                    .addComponent(spnCantidadNeumaticos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPrefijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPrefijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSufijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtSufijoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblIndiceInicio)
                    .addComponent(spnIndiceInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblJustificacion)
                    .addComponent(spnJustificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorUnoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblVistaPrevia)
                    .addComponent(txtVistaPrevia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlDatosPaso1Layout = new javax.swing.GroupLayout(pnlDatosPaso1);
        pnlDatosPaso1.setLayout(pnlDatosPaso1Layout);
        pnlDatosPaso1Layout.setHorizontalGroup(
            pnlDatosPaso1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPaso1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlContenedorUno, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlDatosPaso1Layout.setVerticalGroup(
            pnlDatosPaso1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPaso1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlContenedorUno, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlDatos1.add(pnlDatosPaso1, java.awt.BorderLayout.CENTER);

        pnlPaso1.add(pnlDatos1, java.awt.BorderLayout.CENTER);

        pnlCentral.add(pnlPaso1, "step1");

        jPanel5.setLayout(new java.awt.BorderLayout());

        btnCerrar2.setText("Cerrar");
        btnCerrar2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrar2ActionPerformed(evt);
            }
        });
        pnlOpciones2.add(btnCerrar2);

        btnAnterior2.setText("<< Anterior");
        btnAnterior2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnterior2ActionPerformed(evt);
            }
        });
        pnlOpciones2.add(btnAnterior2);

        btnSiguiente2.setText("Siguiente >>");
        btnSiguiente2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguiente2ActionPerformed(evt);
            }
        });
        pnlOpciones2.add(btnSiguiente2);

        btnFinalizar2.setText("Finalizar");
        btnFinalizar2.setEnabled(false);
        pnlOpciones2.add(btnFinalizar2);

        jPanel5.add(pnlOpciones2, java.awt.BorderLayout.PAGE_END);

        pnlContenedor2.setBackground(new java.awt.Color(151, 184, 205));
        pnlContenedor2.setLayout(new java.awt.BorderLayout());
        pnlContenedor2.add(jSeparator2, java.awt.BorderLayout.PAGE_END);

        lblImagen2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/banner_lateral.png"))); // NOI18N
        pnlContenedor2.add(lblImagen2, java.awt.BorderLayout.LINE_START);

        pnlContenedorDatos2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos básicos de los neumáticos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
        pnlContenedorDatos2.setFont(new java.awt.Font("Tahoma", 0, 12));
        pnlContenedorDatos2.setOpaque(false);

        lblMarca.setText("Marca:");

        lblModelo.setText("Medida:");

        lblEstado.setText("Estado:");

        lblTipoPiso.setText("Tipo de piso:");

        comboMarcas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboMarcas.setMaximumSize(new java.awt.Dimension(56, 20));
        comboMarcas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboMarcasKeyPressed(evt);
            }
        });

        comboBandas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboBandas.setMaximumSize(new java.awt.Dimension(56, 20));
        comboBandas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboBandasKeyPressed(evt);
            }
        });

        comboEstados.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboEstados.setMaximumSize(new java.awt.Dimension(56, 20));
        comboEstados.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboEstadosKeyPressed(evt);
            }
        });

        comboTipoPiso.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboTipoPiso.setMaximumSize(new java.awt.Dimension(56, 20));
        comboTipoPiso.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboTipoPisoKeyPressed(evt);
            }
        });

        lblAlmacen.setText("Almacén:");

        comboAlmacenes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboAlmacenes.setMaximumSize(new java.awt.Dimension(56, 20));
        comboAlmacenes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboAlmacenesKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout pnlContenedorDatos2Layout = new javax.swing.GroupLayout(pnlContenedorDatos2);
        pnlContenedorDatos2.setLayout(pnlContenedorDatos2Layout);
        pnlContenedorDatos2Layout.setHorizontalGroup(
            pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                        .addGap(84, 84, 84)
                        .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                                    .addComponent(lblEstado)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(comboEstados, 0, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                                    .addComponent(lblAlmacen, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(comboAlmacenes, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                                .addComponent(lblMarca)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(comboMarcas, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblModelo)
                                    .addComponent(lblTipoPiso))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(comboTipoPiso, 0, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(comboBandas, 0, 139, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(0, 41, Short.MAX_VALUE))
                    .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator7, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)))
                .addContainerGap())
        );

        pnlContenedorDatos2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lblEstado, lblMarca, lblModelo, lblTipoPiso});

        pnlContenedorDatos2Layout.setVerticalGroup(
            pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatos2Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblMarca)
                    .addComponent(comboMarcas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblModelo)
                    .addComponent(comboBandas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTipoPiso)
                    .addComponent(comboTipoPiso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblAlmacen)
                    .addComponent(comboAlmacenes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlContenedorDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEstado)
                    .addComponent(comboEstados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(57, 57, 57))
        );

        javax.swing.GroupLayout pnlDatos2Layout = new javax.swing.GroupLayout(pnlDatos2);
        pnlDatos2.setLayout(pnlDatos2Layout);
        pnlDatos2Layout.setHorizontalGroup(
            pnlDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatos2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlContenedorDatos2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlDatos2Layout.setVerticalGroup(
            pnlDatos2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatos2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlContenedorDatos2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlContenedor2.add(pnlDatos2, java.awt.BorderLayout.CENTER);

        jPanel5.add(pnlContenedor2, java.awt.BorderLayout.CENTER);

        pnlCentral.add(jPanel5, "step2");

        pnlPaso3.setBackground(new java.awt.Color(151, 184, 205));
        pnlPaso3.setLayout(new java.awt.BorderLayout());

        btnCerrar3.setText("Cerrar");
        btnCerrar3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrar3ActionPerformed(evt);
            }
        });
        pnlOpciones3.add(btnCerrar3);

        btnAnterior3.setText("<< Anterior");
        btnAnterior3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnterior3ActionPerformed(evt);
            }
        });
        pnlOpciones3.add(btnAnterior3);

        btnSiguiente3.setText("Siguiente >>");
        btnSiguiente3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguiente3ActionPerformed(evt);
            }
        });
        pnlOpciones3.add(btnSiguiente3);

        btnFinalizar3.setText("Finalizar");
        btnFinalizar3.setEnabled(false);
        pnlOpciones3.add(btnFinalizar3);

        pnlPaso3.add(pnlOpciones3, java.awt.BorderLayout.PAGE_END);

        pnlDatos3.setLayout(new java.awt.BorderLayout());
        pnlDatos3.add(jSeparator3, java.awt.BorderLayout.PAGE_END);

        lblImagen3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/banner_lateral.png"))); // NOI18N
        lblImagen3.setOpaque(true);
        pnlDatos3.add(lblImagen3, java.awt.BorderLayout.LINE_START);

        pnlDatosPaso3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Información Técnica", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
        pnlDatosPaso3.setOpaque(false);

        lblNumeroCapas.setText("Número de capas:");

        spnNumeroCapas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                spnNumeroCapasKeyPressed(evt);
            }
        });

        lblProfundidadMinima.setText("Profundidad mínima:");

        txtProfundidadMinima.setText("0.0");
        txtProfundidadMinima.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtProfundidadMinimaKeyPressed(evt);
            }
        });

        lblMM.setText("mm");

        lblPresionMinima.setText("Presión mínima:");

        txtPresionMinima.setText("0.0");
        txtPresionMinima.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtPresionMinimaKeyPressed(evt);
            }
        });

        lblLBS.setText("lbs");

        lblEstadoMedicion.setText("Estado de medición:");

        cmbEstadoMedicion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout pnlDatosPaso3Layout = new javax.swing.GroupLayout(pnlDatosPaso3);
        pnlDatosPaso3.setLayout(pnlDatosPaso3Layout);
        pnlDatosPaso3Layout.setHorizontalGroup(
            pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                        .addComponent(lblEstadoMedicion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cmbEstadoMedicion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                        .addComponent(lblPresionMinima)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtPresionMinima))
                    .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                        .addComponent(lblNumeroCapas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(spnNumeroCapas, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                        .addComponent(lblProfundidadMinima)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtProfundidadMinima, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMM)
                    .addComponent(lblLBS))
                .addContainerGap(42, Short.MAX_VALUE))
        );

        pnlDatosPaso3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lblNumeroCapas, lblPresionMinima, lblProfundidadMinima});

        pnlDatosPaso3Layout.setVerticalGroup(
            pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPaso3Layout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumeroCapas)
                    .addComponent(spnNumeroCapas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblProfundidadMinima)
                    .addComponent(txtProfundidadMinima, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMM))
                .addGap(18, 18, 18)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPresionMinima)
                    .addComponent(txtPresionMinima, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblLBS))
                .addGap(18, 18, 18)
                .addGroup(pnlDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEstadoMedicion)
                    .addComponent(cmbEstadoMedicion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(104, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlContenedorDatosPaso3Layout = new javax.swing.GroupLayout(pnlContenedorDatosPaso3);
        pnlContenedorDatosPaso3.setLayout(pnlContenedorDatosPaso3Layout);
        pnlContenedorDatosPaso3Layout.setHorizontalGroup(
            pnlContenedorDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatosPaso3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDatosPaso3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlContenedorDatosPaso3Layout.setVerticalGroup(
            pnlContenedorDatosPaso3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatosPaso3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDatosPaso3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlDatos3.add(pnlContenedorDatosPaso3, java.awt.BorderLayout.CENTER);

        pnlPaso3.add(pnlDatos3, java.awt.BorderLayout.CENTER);

        pnlCentral.add(pnlPaso3, "step3");

        pnlPaso4.setBackground(new java.awt.Color(151, 184, 205));
        pnlPaso4.setLayout(new java.awt.BorderLayout());

        btnCerrar4.setText("Cerrar");
        btnCerrar4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrar4ActionPerformed(evt);
            }
        });
        pnlOpciones4.add(btnCerrar4);

        btnAnterior4.setText("<< Anterior");
        btnAnterior4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnterior4ActionPerformed(evt);
            }
        });
        pnlOpciones4.add(btnAnterior4);

        btnSiguiente4.setText("Siguiente>>");
        btnSiguiente4.setEnabled(false);
        pnlOpciones4.add(btnSiguiente4);

        btnFinalizar4.setText("Finalizar");
        btnFinalizar4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFinalizar4ActionPerformed(evt);
            }
        });
        pnlOpciones4.add(btnFinalizar4);

        pnlPaso4.add(pnlOpciones4, java.awt.BorderLayout.PAGE_END);

        pnlContenedorPaso4.setLayout(new java.awt.BorderLayout());
        pnlContenedorPaso4.add(jSeparator4, java.awt.BorderLayout.PAGE_END);

        lblImagen4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/banner_lateral.png"))); // NOI18N
        pnlContenedorPaso4.add(lblImagen4, java.awt.BorderLayout.LINE_START);

        pnlDatos4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Información de Compra", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
        pnlDatos4.setOpaque(false);

        lblNumeroFactura.setText("<html>Número de factura: <font color=\"red\">(*)</font> </html>");

        txtNumeroFactura.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtNumeroFacturaKeyPressed(evt);
            }
        });

        lblFechaCompra.setText("Fecha de compra:");

        dateFechaCompra.setDateFormatString("dd/MM/yyyy");
        dateFechaCompra.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                dateFechaCompraKeyPressed(evt);
            }
        });

        lblDistribuidor.setText("Distribuidor:");

        comboDistribuidores.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboDistribuidores.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboDistribuidoresKeyPressed(evt);
            }
        });

        lblPrecioUnitario.setText("Precio Unitario ($):");

        txtPrecioUnitario.setText("0.0");
        txtPrecioUnitario.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtPrecioUnitarioKeyPressed(evt);
            }
        });

        lblGarantiaDias.setText("Garantía (días):");

        lblGarantiaKM.setText("Garantía (km):");

        txtGarantiaDias.setText("0");
        txtGarantiaDias.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtGarantiaDiasKeyPressed(evt);
            }
        });

        txtGarantiaKM.setText("0");
        txtGarantiaKM.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtGarantiaKMKeyPressed(evt);
            }
        });

        lblFormaPago.setText("Formas de pago:");

        comboFormasPago.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboFormasPago.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboFormasPagoKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout pnlDatos4Layout = new javax.swing.GroupLayout(pnlDatos4);
        pnlDatos4.setLayout(pnlDatos4Layout);
        pnlDatos4Layout.setHorizontalGroup(
            pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatos4Layout.createSequentialGroup()
                .addGap(58, 58, 58)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(pnlDatos4Layout.createSequentialGroup()
                        .addComponent(lblNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlDatos4Layout.createSequentialGroup()
                        .addComponent(lblFechaCompra)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dateFechaCompra, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(pnlDatos4Layout.createSequentialGroup()
                        .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDistribuidor)
                            .addComponent(lblPrecioUnitario))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(comboDistribuidores, 0, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtPrecioUnitario, javax.swing.GroupLayout.DEFAULT_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlDatos4Layout.createSequentialGroup()
                        .addComponent(lblGarantiaDias)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtGarantiaDias, javax.swing.GroupLayout.DEFAULT_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlDatos4Layout.createSequentialGroup()
                        .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblGarantiaKM)
                            .addComponent(lblFormaPago))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtGarantiaKM, javax.swing.GroupLayout.DEFAULT_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(comboFormasPago, 0, 156, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlDatos4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lblDistribuidor, lblFechaCompra, lblGarantiaDias, lblGarantiaKM, lblNumeroFactura, lblPrecioUnitario});

        pnlDatos4Layout.setVerticalGroup(
            pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatos4Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNumeroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(dateFechaCompra, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblFechaCompra, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDistribuidor)
                    .addComponent(comboDistribuidores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtPrecioUnitario)
                    .addComponent(lblPrecioUnitario, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblGarantiaDias)
                    .addComponent(txtGarantiaDias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblGarantiaKM)
                    .addComponent(txtGarantiaKM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlDatos4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblFormaPago)
                    .addComponent(comboFormasPago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlContenedorDatosPaso4Layout = new javax.swing.GroupLayout(pnlContenedorDatosPaso4);
        pnlContenedorDatosPaso4.setLayout(pnlContenedorDatosPaso4Layout);
        pnlContenedorDatosPaso4Layout.setHorizontalGroup(
            pnlContenedorDatosPaso4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatosPaso4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDatos4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlContenedorDatosPaso4Layout.setVerticalGroup(
            pnlContenedorDatosPaso4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorDatosPaso4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDatos4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pnlContenedorPaso4.add(pnlContenedorDatosPaso4, java.awt.BorderLayout.CENTER);

        pnlPaso4.add(pnlContenedorPaso4, java.awt.BorderLayout.CENTER);

        pnlCentral.add(pnlPaso4, "step4");

        pnlPasoFinal.setBackground(new java.awt.Color(151, 184, 205));
        pnlPasoFinal.setLayout(new java.awt.BorderLayout());

        pnlOpcionesFinales.setLayout(new java.awt.BorderLayout());

        btnCerrar5.setText("Cerrar");
        btnCerrar5.setEnabled(false);
        pnlContenedorOpcionesFinales.add(btnCerrar5);

        btnAnterior5.setText("<< Anterior");
        btnAnterior5.setEnabled(false);
        btnAnterior5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnterior5ActionPerformed(evt);
            }
        });
        pnlContenedorOpcionesFinales.add(btnAnterior5);

        btnSiguiente5.setText("Siguiente >>");
        btnSiguiente5.setEnabled(false);
        pnlContenedorOpcionesFinales.add(btnSiguiente5);

        btnFinalizar5.setText("Finalizar");
        btnFinalizar5.setEnabled(false);
        pnlContenedorOpcionesFinales.add(btnFinalizar5);

        pnlOpcionesFinales.add(pnlContenedorOpcionesFinales, java.awt.BorderLayout.CENTER);
        pnlOpcionesFinales.add(jSeparator8, java.awt.BorderLayout.PAGE_START);

        pnlPasoFinal.add(pnlOpcionesFinales, java.awt.BorderLayout.PAGE_END);

        pnlContenedorFinal.setBackground(new java.awt.Color(151, 184, 205));
        pnlContenedorFinal.setLayout(new java.awt.BorderLayout());

        lblImagenFinal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/banner_lateral.png"))); // NOI18N
        pnlContenedorFinal.add(lblImagenFinal, java.awt.BorderLayout.LINE_START);

        lblProgreso.setText("Pogreso:");

        barraProgreso.setStringPainted(true);

        javax.swing.GroupLayout pnlDatosFinalLayout = new javax.swing.GroupLayout(pnlDatosFinal);
        pnlDatosFinal.setLayout(pnlDatosFinalLayout);
        pnlDatosFinalLayout.setHorizontalGroup(
            pnlDatosFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosFinalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDatosFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblProgreso, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
                    .addComponent(barraProgreso, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlDatosFinalLayout.setVerticalGroup(
            pnlDatosFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosFinalLayout.createSequentialGroup()
                .addGap(133, 133, 133)
                .addComponent(lblProgreso)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(barraProgreso, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(184, Short.MAX_VALUE))
        );

        pnlContenedorFinal.add(pnlDatosFinal, java.awt.BorderLayout.CENTER);

        pnlPasoFinal.add(pnlContenedorFinal, java.awt.BorderLayout.CENTER);

        pnlCentral.add(pnlPasoFinal, "finish");

        pnlContenedor.add(pnlCentral, java.awt.BorderLayout.CENTER);

        getContentPane().add(pnlContenedor, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSiguiente1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguiente1ActionPerformed
        // TODO add your handling code here:
        cantidad_neumáticos = Integer.parseInt(spnCantidadNeumaticos.getValue().toString());
        if (cantidad_neumáticos > 0) {
            prefijo = txtPrefijoCodigo.getText();
            sufijo = txtSufijoCodigo.getText();
            indice_inicio = Integer.parseInt(spnIndiceInicio.getValue().toString());
            justificacion = Integer.parseInt(spnJustificacion.getValue().toString());
            if (!prefijo.isEmpty() || !sufijo.isEmpty()) {
//                if () {
                card.show(pnlCentral, "step2");
                comboMarcas.requestFocusInWindow();
//                } else {
//                    JOptionPane.showMessageDialog(this, "El sufijo no puede ser nulo.", "Datos incorrectos", JOptionPane.INFORMATION_MESSAGE);
//                    jTextField2.requestFocusInWindow();
//                }
            } else {
                JOptionPane.showMessageDialog(this, "El prefijo o el sufijo no pueden ser nulos.", "Datos incorrectos", JOptionPane.INFORMATION_MESSAGE);
                txtPrefijoCodigo.requestFocusInWindow();
            }
        } else {
            JOptionPane.showMessageDialog(this, "La cantidad de neumáticos debe ser mayor que uno.", "Datos incorrectos", JOptionPane.INFORMATION_MESSAGE);
            spnCantidadNeumaticos.requestFocusInWindow();
        }
    }//GEN-LAST:event_btnSiguiente1ActionPerformed

    private void btnSiguiente2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguiente2ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step3");
        spnNumeroCapas.requestFocusInWindow();
        
    }//GEN-LAST:event_btnSiguiente2ActionPerformed

    private void btnSiguiente3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguiente3ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step4");
        txtNumeroFactura.requestFocusInWindow();
    }//GEN-LAST:event_btnSiguiente3ActionPerformed

    private void btnAnterior4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnterior4ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step3");
    }//GEN-LAST:event_btnAnterior4ActionPerformed

    private void btnAnterior3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnterior3ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step2");
    }//GEN-LAST:event_btnAnterior3ActionPerformed

    private void btnAnterior2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnterior2ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step1");
    }//GEN-LAST:event_btnAnterior2ActionPerformed

    private void btnFinalizar4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizar4ActionPerformed
        // TODO add your handling code here:
        if (!txtNumeroFactura.getText().isEmpty()) {
            card.show(pnlCentral, "finish");
            try {
                int numero_capas = Integer.parseInt(spnNumeroCapas.getValue().toString());
                int garantia_dias = Integer.parseInt(txtGarantiaDias.getText());
                int garantia_km = Integer.parseInt(txtGarantiaKM.getText());
                double profundidad_minima = Double.parseDouble(txtProfundidadMinima.getText());
                double presion_minima = Double.parseDouble(txtPresionMinima.getText());
                float precio_unitario = Float.parseFloat(txtPrecioUnitario.getText());
                MarcasNeumatico marca = (MarcasNeumatico) comboMarcas.getSelectedItem();
                ModelosBandaNeumatico modelo = (ModelosBandaNeumatico) comboBandas.getSelectedItem();
                TipoPiso tipo_piso = (TipoPiso) comboTipoPiso.getSelectedItem();
                Almacenes almacen = (Almacenes) comboAlmacenes.getSelectedItem();
                EstadosNeumaticos estado = (EstadosNeumaticos) comboEstados.getSelectedItem();
                EstadosMedicion estadoMedicion = (EstadosMedicion) cmbEstadoMedicion.getSelectedItem();
                DistribuidoresNeumaticos distribuidor = (DistribuidoresNeumaticos) comboDistribuidores.getSelectedItem();
                FormasPago forma = (FormasPago) comboFormasPago.getSelectedItem();
                HiloGuardarNeumaticos guardar = new HiloGuardarNeumaticos(false, dateFechaRegistro.getDate(), dateFechaCompra.getDate(), cantidad_neumáticos, numero_capas, garantia_dias, garantia_km, profundidad_minima, presion_minima, precio_unitario, txtNumeroFactura.getText().trim(), marca, modelo, tipo_piso, almacen, estado, estadoMedicion, distribuidor, forma, this, codigos);
                Thread t_guardar = new Thread(guardar);
                t_guardar.start();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(Principal.getInstance(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(this, "Se requiere un número de factura.", "Datos incompletos", JOptionPane.WARNING_MESSAGE);
            txtNumeroFactura.requestFocusInWindow();
        }
    }//GEN-LAST:event_btnFinalizar4ActionPerformed

    private void btnAnterior5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnterior5ActionPerformed
        // TODO add your handling code here:
        card.show(pnlCentral, "step4");
    }//GEN-LAST:event_btnAnterior5ActionPerformed

private void btnCerrar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrar1ActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_btnCerrar1ActionPerformed

private void btnCerrar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrar2ActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_btnCerrar2ActionPerformed

private void btnCerrar3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrar3ActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_btnCerrar3ActionPerformed

private void btnCerrar4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrar4ActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_btnCerrar4ActionPerformed

    private void spnCantidadNeumaticosKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_spnCantidadNeumaticosKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtPrefijoCodigo.requestFocusInWindow();
        }
    }//GEN-LAST:event_spnCantidadNeumaticosKeyPressed

    private void txtPrefijoCodigoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPrefijoCodigoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtSufijoCodigo.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtPrefijoCodigoKeyPressed

    private void txtSufijoCodigoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSufijoCodigoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            spnIndiceInicio.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtSufijoCodigoKeyPressed

    private void spnIndiceInicioKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_spnIndiceInicioKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            spnJustificacion.requestFocusInWindow();
        }
    }//GEN-LAST:event_spnIndiceInicioKeyPressed

    private void spnJustificacionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_spnJustificacionKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnSiguiente1.requestFocusInWindow();
        }
    }//GEN-LAST:event_spnJustificacionKeyPressed

    private void spnNumeroCapasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_spnNumeroCapasKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtProfundidadMinima.requestFocusInWindow();
        }
    }//GEN-LAST:event_spnNumeroCapasKeyPressed

    private void txtProfundidadMinimaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtProfundidadMinimaKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtPresionMinima.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtProfundidadMinimaKeyPressed

    private void txtPresionMinimaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPresionMinimaKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnSiguiente3.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtPresionMinimaKeyPressed

    private void txtNumeroFacturaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumeroFacturaKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            dateFechaCompra.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtNumeroFacturaKeyPressed

    private void dateFechaCompraKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_dateFechaCompraKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboDistribuidores.requestFocusInWindow();
        }
    }//GEN-LAST:event_dateFechaCompraKeyPressed

    private void comboDistribuidoresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboDistribuidoresKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtPrecioUnitario.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboDistribuidoresKeyPressed

    private void txtPrecioUnitarioKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPrecioUnitarioKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtGarantiaDias.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtPrecioUnitarioKeyPressed

    private void txtGarantiaDiasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtGarantiaDiasKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            txtGarantiaKM.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtGarantiaDiasKeyPressed

    private void txtGarantiaKMKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtGarantiaKMKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboFormasPago.requestFocusInWindow();
        }
    }//GEN-LAST:event_txtGarantiaKMKeyPressed

    private void comboFormasPagoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboFormasPagoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnFinalizar4.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboFormasPagoKeyPressed

    private void comboMarcasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboMarcasKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboBandas.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboMarcasKeyPressed

    private void comboBandasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboBandasKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboTipoPiso.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboBandasKeyPressed

    private void comboTipoPisoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboTipoPisoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboAlmacenes.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboTipoPisoKeyPressed

    private void comboAlmacenesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboAlmacenesKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            comboEstados.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboAlmacenesKeyPressed

    private void comboEstadosKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboEstadosKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            btnSiguiente2.requestFocusInWindow();
        }
    }//GEN-LAST:event_comboEstadosKeyPressed

    private void dateFechaRegistroKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_dateFechaRegistroKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            spnCantidadNeumaticos.requestFocusInWindow();
        }
    }//GEN-LAST:event_dateFechaRegistroKeyPressed

    public void generacionCodigos() {
        cantidad_neumáticos = Integer.parseInt(spnCantidadNeumaticos.getValue().toString());
        codigos = new String[cantidad_neumáticos];
        prefijo = txtPrefijoCodigo.getText();
        sufijo = txtSufijoCodigo.getText();
        indice_inicio = Integer.parseInt(spnIndiceInicio.getValue().toString());
        justificacion = Integer.parseInt(spnJustificacion.getValue().toString());

        String temp = "" + cantidad_neumáticos;
        int numero_digitos = temp.length();
        if (!prefijo.isEmpty() || !sufijo.isEmpty()) {
            if (justificacion >= numero_digitos) {
                for (int i = 0; i < cantidad_neumáticos; i++) {
                    String index = "";
                    int pos = indice_inicio + i;
                    int num_ceros = ("" + pos).length();
                    int cantidad = justificacion - num_ceros;
                    if (cantidad > 0) {
                        for (int j = 0; j < cantidad; j++) {
                            index += "0";
                        }
                    }
                    codigos[i] = (prefijo + index + pos + sufijo).toUpperCase();
                    txtVistaPrevia.setText((prefijo + index + pos + sufijo).toUpperCase());
                }
            } else {
                for (int i = 0; i < cantidad_neumáticos; i++) {
                    int pos = indice_inicio + i;
                    codigos[i] = (prefijo + pos + sufijo).toUpperCase();
                    txtVistaPrevia.setText((prefijo + pos + sufijo).toUpperCase());
                }
            }
        }
    }
    //    /**
//     * @param args the command line arguments
//     */
//    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(RegistroMasivoNeumaticos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(RegistroMasivoNeumaticos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(RegistroMasivoNeumaticos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(RegistroMasivoNeumaticos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the dialog
//         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                RegistroMasivoNeumaticos dialog = new RegistroMasivoNeumaticos(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//
//                    @Override
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JProgressBar barraProgreso;
    private javax.swing.JButton btnAnterior1;
    private javax.swing.JButton btnAnterior2;
    private javax.swing.JButton btnAnterior3;
    private javax.swing.JButton btnAnterior4;
    private javax.swing.JButton btnAnterior5;
    private javax.swing.JButton btnCerrar1;
    private javax.swing.JButton btnCerrar2;
    private javax.swing.JButton btnCerrar3;
    private javax.swing.JButton btnCerrar4;
    private javax.swing.JButton btnCerrar5;
    private javax.swing.JButton btnFinalizar1;
    private javax.swing.JButton btnFinalizar2;
    private javax.swing.JButton btnFinalizar3;
    private javax.swing.JButton btnFinalizar4;
    private javax.swing.JButton btnFinalizar5;
    private javax.swing.JButton btnSiguiente1;
    private javax.swing.JButton btnSiguiente2;
    private javax.swing.JButton btnSiguiente3;
    private javax.swing.JButton btnSiguiente4;
    private javax.swing.JButton btnSiguiente5;
    private javax.swing.JComboBox cmbEstadoMedicion;
    private javax.swing.JComboBox comboAlmacenes;
    private javax.swing.JComboBox comboBandas;
    private javax.swing.JComboBox comboDistribuidores;
    private javax.swing.JComboBox comboEstados;
    private javax.swing.JComboBox comboFormasPago;
    private javax.swing.JComboBox comboMarcas;
    private javax.swing.JComboBox comboTipoPiso;
    private com.toedter.calendar.JDateChooser dateFechaCompra;
    private com.toedter.calendar.JDateChooser dateFechaRegistro;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JSeparator jSeparator8;
    private javax.swing.JLabel lblAlmacen;
    private javax.swing.JLabel lblCantidadNeumaticos;
    private javax.swing.JLabel lblDistribuidor;
    private javax.swing.JLabel lblEstado;
    private javax.swing.JLabel lblEstadoMedicion;
    private javax.swing.JLabel lblFechaCompra;
    private javax.swing.JLabel lblFechaRegistro;
    private javax.swing.JLabel lblFormaPago;
    private javax.swing.JLabel lblGarantiaDias;
    private javax.swing.JLabel lblGarantiaKM;
    private javax.swing.JLabel lblImagen1;
    private javax.swing.JLabel lblImagen2;
    private javax.swing.JLabel lblImagen3;
    private javax.swing.JLabel lblImagen4;
    private javax.swing.JLabel lblImagenFinal;
    private javax.swing.JLabel lblIndiceInicio;
    private javax.swing.JLabel lblJustificacion;
    private javax.swing.JLabel lblLBS;
    private javax.swing.JLabel lblMM;
    private javax.swing.JLabel lblMarca;
    private javax.swing.JLabel lblModelo;
    private javax.swing.JLabel lblNumeroCapas;
    private javax.swing.JLabel lblNumeroFactura;
    private javax.swing.JLabel lblPrecioUnitario;
    private javax.swing.JLabel lblPrefijoCodigo;
    private javax.swing.JLabel lblPresionMinima;
    private javax.swing.JLabel lblProfundidadMinima;
    private javax.swing.JLabel lblProgreso;
    private javax.swing.JLabel lblSufijoCodigo;
    private javax.swing.JLabel lblTipoPiso;
    private javax.swing.JLabel lblVistaPrevia;
    private javax.swing.JPanel pnlCentral;
    private javax.swing.JPanel pnlContenedor;
    private javax.swing.JPanel pnlContenedor2;
    private javax.swing.JPanel pnlContenedorDatos2;
    private javax.swing.JPanel pnlContenedorDatosPaso3;
    private javax.swing.JPanel pnlContenedorDatosPaso4;
    private javax.swing.JPanel pnlContenedorFinal;
    private javax.swing.JPanel pnlContenedorOpcionesFinales;
    private javax.swing.JPanel pnlContenedorPaso4;
    private javax.swing.JPanel pnlContenedorUno;
    private javax.swing.JPanel pnlDatos1;
    private javax.swing.JPanel pnlDatos2;
    private javax.swing.JPanel pnlDatos3;
    private javax.swing.JPanel pnlDatos4;
    private javax.swing.JPanel pnlDatosFinal;
    private javax.swing.JPanel pnlDatosPaso1;
    private javax.swing.JPanel pnlDatosPaso3;
    private javax.swing.JPanel pnlOpciones1;
    private javax.swing.JPanel pnlOpciones2;
    private javax.swing.JPanel pnlOpciones3;
    private javax.swing.JPanel pnlOpciones4;
    private javax.swing.JPanel pnlOpcionesFinales;
    private javax.swing.JPanel pnlPaso1;
    private javax.swing.JPanel pnlPaso3;
    private javax.swing.JPanel pnlPaso4;
    private javax.swing.JPanel pnlPasoFinal;
    private javax.swing.JSpinner spnCantidadNeumaticos;
    private javax.swing.JSpinner spnIndiceInicio;
    private javax.swing.JSpinner spnJustificacion;
    private javax.swing.JSpinner spnNumeroCapas;
    private javax.swing.JTextField txtGarantiaDias;
    private javax.swing.JTextField txtGarantiaKM;
    private javax.swing.JTextField txtNumeroFactura;
    private javax.swing.JTextField txtPrecioUnitario;
    private javax.swing.JTextField txtPrefijoCodigo;
    private javax.swing.JTextField txtPresionMinima;
    private javax.swing.JTextField txtProfundidadMinima;
    private javax.swing.JTextField txtSufijoCodigo;
    private javax.swing.JTextField txtVistaPrevia;
    // End of variables declaration//GEN-END:variables
}
